
<?php
//naredi include, mora biti {}
include_once("seja.php"); 
require_once 'projekt_st/spletne/controller/OsebaController.php';
{

    $streznik = $_SERVER["HTTP_HOST"];  
	$pot = rtrim(dirname($_SERVER["PHP_SELF"]), "/\\");
	
	$controller  = new OsebaController();
	$oseba = $controller->showProfile($_SESSION["uporabnik"]["idoseba"]);
	//print_r($_POST);
    
    	if(isset($_POST["edit"])){
    		array_pop($_POST);
    		$data = $_POST;
    		//print_r($data);
    		$test = $controller->editProfile($_SESSION["uporabnik"]["idoseba"],$data);
    		header( "Location: http://".$streznik."".$pot."/showProfile.php?podatki=profil");	
    			
    	}
        else if(isset($_POST['aktivnost']) && $_POST['naziv'] != "" && $_POST['tipAktivnosti'] != "") {
            array_pop($_POST);
    		$data = $_POST;
    		//print_r($data);
            $data['oseba_idoseba'] = $_SESSION['uporabnik']['idoseba'];
            $controller->setAktivnostControl($data);
            header( "Location: http://".$streznik."".$pot."/showProfile.php?podatki=aktivnost");
        }
        
        else if(isset($_POST['izobrazba']) && $_POST['nazivIzobrazbe'] != "" && $_POST['sola'] != "" && $_POST['pridobljenaZnanja'] != "") {
            array_pop($_POST);
    		$data = $_POST;
    		//print_r($data);
            $data['oseba_idoseba'] = $_SESSION['uporabnik']['idoseba'];
            $controller->setIzobrazbaControl($data);
            header( "Location: http://".$streznik."".$pot."/showProfile.php?podatki=izobrazba");
        }
        
        else if(isset($_POST['znanje']) && $_POST['nazivZnanja'] != "" && $_POST['tipZnanja'] != "") {
            array_pop($_POST);
    		$data = $_POST;
    		//print_r($data);
            $data['oseba_idoseba'] = $_SESSION['uporabnik']['idoseba'];
            $controller->setZnanjeControl($data);
            header( "Location: http://".$streznik."".$pot."/showProfile.php?podatki=znanje");
        }
        
        else if(isset($_POST['delovne']) && $_POST['delovnoMesto'] != "" && $_POST['poklic'] != "" && $_POST['letoOd'] != "" && $_POST['letoDo'] != "") {
            array_pop($_POST);
    		$data = $_POST;
    		//print_r($data);
            $data['oseba_idoseba'] = $_SESSION['uporabnik']['idoseba'];
            $controller->setDelovneControl($data);
            header( "Location: http://".$streznik."".$pot."/showProfile.php?podatki=poklic");
        } 
        
        else if(isset($_POST['jezik']) && $_POST['imeJezika'] != "" && $_POST['aktivno'] != "") {
            array_pop($_POST);
    		$data = $_POST;
    		//print_r($data);
            $data['oseba_idoseba'] = $_SESSION['uporabnik']['idoseba'];
            $controller->setJeziki($data);
            header( "Location: http://".$streznik."".$pot."/showProfile.php?podatki=jezik");
        } else {
            $_GET['prvic']='nekaj';
        }
    
    

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>StudentWorld</title>
    <link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
    <div id="wrapper">
    	<div id="header-wrapper">
        
    		<?php include_once("glava.php"); ?>
            
    	</div>
    	<!-- end #header -->
    	<div id="page">
    		<div id="page-bgtop">
    			<div id="page-bgbtm">
    				<div id="content">
    					<div class="post">   
    											
    						<div style="clear: both;">&nbsp;</div>
    						<div class="entry">
    							<p>Profil</p>
    							<form method="post" action="editProfile.php">
                                <div>
                                <p>Pri področjih znanje, aktivnosti, jeziki, delovne izkušnje in izobrazba je potrebno izpolniti vsa polja!</p>
                                <p>V nasprotnem primeru ne boste mogli dodati novega zapisa v vaš profil!</p>
    							<table>
                                    <tr>
                                        <td>Ime:</td>
                                        <td><input type="text" name="ime" id="ime" value="<?php echo $oseba->getIme()?>" readonly="readonly" /></td>
                                    </tr>
                                    <tr>
                                        <td>Priimek:</td>
                                        <td><input type="text" name="priimek" id="priimek" value="<?php echo $oseba->getPriimek()?>"  readonly="readonly"/></td>
                                    </tr>
                                    <tr>
                                        <td>Datum rojstva: (LLLL-MM-DD)</td>
                                        <td><input type="text" name="datumRojstva" id="datumRojstva" value="<?php echo $oseba->getDatumRojstva()?>" /></td>
                                    </tr>
                                    <tr>
                                        <td>Naslov:</td>
                                        <td><input type="text" name="naslov" id="naslov" value="<?php echo $oseba->getNaslov()?>" /></td>
                                    </tr>
                                    <tr>
                                        <td>Pošta:</td>
                                        <td><input type="text" name="posta" id="posta" value="<?php echo $oseba->getPosta()?>" /></td>
                                    </tr>
                                    <tr>
                                        <td>Email:</td>
                                        <td><input type="text" name="email" id="email" value="<?php echo $oseba->getEmail()?>" /></td>
                                    </tr>
                                    <tr>
                                        <td>Telefon:</td>
                                        <td><input type="text" name="telefon" id="telefon" value="<?php echo $oseba->getTelefon()?>" /></td>
                                    </tr>
                                    <tr>
                                        <td>Vozniška:</td>
                                        <td><input type="text" name="voznisko" id="voznisko" value="<?php echo $oseba->getVoznisko()?>" /></td>
                                    </tr>
                                    </table>
                                    <p><input type="submit" id="edit" name="edit" value="edit" /></p>
                                </div>
                                </form>
                                <div>
                                    <form method="post" action="editProfile.php">
                                    <table>
                                        <tr>
                                            <td>Vnesi aktivnost</td>
                                            <td><input type="text" name="naziv" id="naziv" value="" /></td>    
                                        </tr>
                                        <tr>
                                            <td>Vnesi tip aktivnosti</td>
                                            <td><input type="text" name="tipAktivnosti" id="tipAktivnosti" value="" /></td>
                                        </tr>
                                        <tr>
                                            <td><input type="submit" id="aktivnost" name="aktivnost" value="Dodaj" /></td>
                                        </tr>
                                    </table>
                                    </form>
                                </div>
                                <div>
                                    <form method="post" action="editProfile.php">
                                    <table>
                                        <tr>
                                            <td>Vnesi izobrazbo</td>
                                            <td><input type="text" name="nazivIzobrazbe" id="nazivIzobrazbe" value="" /></td>    
                                        </tr>
                                        <tr>
                                            <td>Vnesi solo</td>
                                            <td><input type="text" name="sola" id="sola" value="" /></td>
                                        </tr>
                                        <tr>
                                            <td>Vnesi pridobljena znanja</td>
                                            <td><input type="text" name="pridobljenaZnanja" id="pridobljenaZnanja" value="" /></td>
                                        </tr>
                                        <tr>
                                            <td><input type="submit" id="izobrazba" name="izobrazba" value="Dodaj" /></td>
                                        </tr>
                                    </table>
                                    </form>
                                </div>
                                <div>
                                    <form method="post" action="editProfile.php">
                                    <table>
                                        <tr>
                                            <td>Vnesi znanje</td>
                                            <td><input type="text" name="nazivZnanja" id="nazivZnanja" value="" /></td>    
                                        </tr>
                                        <tr>
                                            <td>Vnesi tip znanja</td>
                                            <td><input type="text" name="tipZnanja" id="tipZnanja" value="" /></td>
                                        </tr>
                                        <tr>
                                            <td><input type="submit" id="znanje" name="znanje" value="Dodaj" /></td>
                                        </tr>
                                    </table>
                                    </form>
                                </div>
                                <div>
                                    <form method="post" action="editProfile.php">
                                    <table>
                                        <tr>
                                            <td>Vnesi delovno mesto</td>
                                            <td><input type="text" name="delovnoMesto" id="delovnoMesto" value="" /></td>    
                                        </tr>
                                        <tr>
                                            <td>Vnesi poklic</td>
                                            <td><input type="text" name="poklic" id="poklic" value="" /></td>
                                        </tr>
                                        <tr>
                                            <td>Vnesi začetno leto</td>
                                            <td><input type="text" name="letoOd" id="letoOd" value="" /></td>
                                        </tr>
                                        <tr>
                                            <td>Vnesi končno leto</td>
                                            <td><input type="text" name="letoDo" id="letoDo" value="" /></td>
                                        </tr>
                                        <tr>
                                            <td><input type="submit" id="delovne" name="delovne" value="Dodaj" /></td>
                                        </tr>
                                    </table>
                                    </form>
                                </div>
                                <div>
                                    <form method="post" action="editProfile.php">
                                    <table>
                                        <tr>
                                            <td>Vnesi jezik</td>
                                            <td><input type="text" name="imeJezika" id="imeJezika" value="" /></td>    
                                        </tr>
                                        <tr>
                                            <td>Vnesi aktivno/pasivno</td>
                                            <td><input type="text" name="aktivno" id="aktivno" value="" /></td>
                                        </tr>
                                        <tr>
                                            <td><input type="submit" id="jezik" name="jezik" value="Dodaj" /></td>
                                        </tr>
                                    </table>
                                    </form>
                                </div>
    						</div>
    					</div>
    					
    					<div style="clear: both;">&nbsp;</div>
    				</div>
    				<!-- end #content -->
    				<div id="sidebar">
    					<ul>
    						
                            <?php

                                include_once('sidebar.php');

							?>
                            
    						<!--   <li>
    							<h2>Categories</h2>
    							<ul>
    								<li></li>
    								<li><a href="#">Consectetuer adipiscing elit</a></li>
    								<li><a href="#">Metus aliquam pellentesque</a></li>
    								<li><a href="#">Suspendisse iaculis mauris</a></li>
    								<li><a href="#">Urnanet non molestie semper</a></li>
    								<li><a href="#">Proin gravida orci porttitor</a></li>
    							</ul>
    						</li> -->
    					</ul>
    				</div>
    				<!-- end #sidebar -->
    				<div style="clear: both;">&nbsp;</div>
    			</div>
    		</div>
    	</div>
    	<!-- end #page -->
    </div>
    <?php  include_once("noga.php"); } ?>
    <!-- end #footer -->
</body>
</html>
